import {cartAPI} from "@/services/carts"
export default{
    namespaced:true,
    state:{
       cartInfo:[],
       isLoginState:false,
    },
    
    mutations:{
       init(state){
           return state.cartInfo;
       },
       sycGetCar(state,payload){
           state.cartInfo = payload.data;
       },
       clearCar(state){
           state.cartInfo = [];
       }
    },
    actions:{
     async getcars(context){
         const carts = await cartAPI();
         context.commit("sycGetCar",carts)
     }
    },
    getters:{
         loadCarsCount(state){
             return state.cartInfo.length;
         }
    }
}